package o;

import android.os.IBinder;
import android.os.IInterface;
import android.os.Parcel;
import com.huawei.appgallery.parcelable.AutoParcelable;
import com.huawei.appgallery.parcelable.CreateExecption;
import java.lang.reflect.Field;
import java.util.Map;

public class cqr implements cqj<IInterface> {
    public /* synthetic */ void ˊ(Parcel parcel, Field field, int i, Object obj, int i2, boolean z) {
        ॱ(parcel, field, i, (IInterface) obj, i2, z);
    }

    public void ॱ(Parcel parcel, Field field, int i, IInterface iInterface, int i2, boolean z) {
        if (iInterface != null) {
            int ॱ = cqh.ॱ(parcel, i);
            parcel.writeStrongBinder(iInterface.asBinder());
            cqh.ˏ(parcel, ॱ);
        } else if (z) {
            cqh.ˎ(parcel, i, 0);
        }
    }

    public void ˋ(AutoParcelable autoParcelable, Field field, Parcel parcel, int i, Map<String, String> map) throws IllegalAccessException {
        Object obj;
        Class[] declaredClasses = field.getType().getDeclaredClasses();
        int length = declaredClasses.length;
        int i2 = 0;
        while (i2 < length) {
            try {
                field.set(autoParcelable, declaredClasses[i2].getDeclaredMethod("asInterface", new Class[]{IBinder.class}).invoke(null, new Object[]{cqi.ˎ(parcel, i)}));
                obj = 1;
                break;
            } catch (NoSuchMethodException e) {
                cqz.ˏ.ˎ("InterfaceTypeProcess", "can not set the interface" + e.getMessage());
            } catch (Exception e2) {
                cqz.ˏ.ˎ("InterfaceTypeProcess", "can not set the interface" + e2.getMessage());
            }
        }
        obj = null;
        if (obj == null) {
            throw new CreateExecption("Field has broken interface: " + field);
        }
        return;
        i2++;
    }
}
